package com.wjx.user_provider.dao;

import com.wjx.user_provider.model.Serve;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ServeDao {
    //查询所有服务
    @Select("select * from serve")
    public List<Serve> queryAllService();
    //根据关键词模糊查询
    public List<Serve> queryLikeService(@Param("keyword") String keyword);
    //根据id查询服务
    @Select("select * from serve where id = #{id}")
    public Serve queryServiceById(int id);
    //根据服务名查询服务
    @Select("select * from serve where name = #{name}")
    public Serve queryServiceByName(String name);
    //根据id更新服务
    @Update("update serve set name = #{name},description = #{description},price = #{price} " +
            "where id = #{id}")
    public int updateServiceById(Serve serve);
    //根据id删除服务
    @Delete("delete from serve where id = #{id}")
    public int deleteServiceById(int id);
    //添加服务
    @Insert("insert into serve (name ,description ,price ) " +
            "values (#{name},#{description},#{price})")
    public int insertService(Serve serve);
}
